
// **************** \\
// * sh_mounted.lua * \\
// **************** \\

// Version 1.0.0
// Determines if a source game is mounted or not
// By thomasfn


// Define core tables
mount = {}
mount.Version = "1.0.0"
mount.Games = { "css", "tf2", "dod", "portal", "ep1", "ep2" }
mount.ContentTest = {
	css = {
		"maps/cs_office.bsp",
		"maps/cs_assault.bsp",
		"maps/cs_italy.bsp",
		"models/Characters/CounterTerrorist.mdl",
		"models/Characters/Hostage_01.mdl",
		"materials/de_nuke/nuk130t.vmt",
		"materials/de_nuke/nuk130t.vtf"
	},
	portal = {
		"maps/testchmb_a_00.bsp",
		"maps/testchmb_a_01.bsp",
		"maps/testchmb_a_02.bsp",
		"models/Player/chell.mdl",
		"models/Weapons/v_portalgun.mdl",
		"materials/models/portals/Portal_1_Anims.vmt"
	},
	tf2 = {
		"maps/area_badlands.bsp",
		"maps/area_granary.bsp",
		"maps/ctf_well.bsp",
		"models/player/demo.mdl",
		"models/player/medic.mdl",
		"materials/HUD/cart_blue.vmt",
		"materials/HUD/cart_track.vtf"
	},
	dod = {
		"maps/dod_colmar.bsp",
		"maps/dod_flash.bsp",
		"maps/dod_kalt.bsp",
		"models/player/american_sniper.mdl",
		"models/player/american_rifleman.mdl",
		"models/player/german_mg.mdl",
		"materials/HUD/ico_camera.vmt",
		"materials/HUD/leaderboard_dead.vtf"
	},
	ep1 = {
		"models/Zombie/Zombie_Soldier.mdl",
		"sound/npc/zombine/zombine_die1.wav"
	},
	ep2 = {
		"maps/ep2_outland_01a.bsp",
		"maps/ep2_outland_07.bsp",
		"maps/ep2_outland_10.bsp",
		"models/dogVSstrider/rockslide.mdl",
		"models/mini_borealis/mini_borealis.mdl",
		"materials/Tools/toolswhite.vmt"
	}
}

mount.AlwaysMount = {}

// Define functions
function mount.IsMounted( gameid )
	if (mount.AlwaysMount[ gameid ]) then return true end
	local test = mount.ContentTest[ gameid ]
	if (!test) then
		// We have no evidence!
		return true
	end
	for _, v in pairs( test ) do
		if (!file.Exists( v )) then return false end
	end
	return true
end

function mount.ForceMount( gameid )
	mount.AlwaysMount[ gameid ] = true
end

function mount.UnforceMount( gameid )
	mount.AlwaysMount[ gameid ] = false
end